//
//  AlertViewController.m
//  Slider
//
//  Created by Marx on 16/1/23.
//  Copyright © 2016年 test. All rights reserved.
//

#import "AlertViewController.h"

@interface AlertViewController ()
//@property (nonatomic, copy)NSString *meg;
@end

@implementation AlertViewController

+ (AlertViewController *)shareInstance {
    static AlertViewController *alert = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        alert = [AlertViewController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
    });
    return alert;
}

- (void)showInfo:(NSString *)title message:(NSString *)message {
    self.title = title;
    self.message = message;
    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        self.block(YES);
    }];
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        self.block(NO);
    }];
    [self addAction:okAction];
    [self addAction:cancelAction];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
